fix: remove urlfave/cli built-in -h flag that is causing confusing behavior#2294
Merged
Conversation
4 tasks
Stratus3D
commented
Jul 9, 2026
| log.SetFlags(0) | ||
|
|
||
| app := &cli.Command{ | ||
| HideHelp: true, |
Member
Author
There was a problem hiding this comment.
Don't generate the global --help/-h flag or the urlfave/cli generated help command. Our own help subcommand is better. The -h help flag behavior was also confusing in contexts where the user did not intend to request the help output.
Stratus3D
commented
Jul 9, 2026
| Action: func(_ context.Context, cmd *cli.Command) error { | ||
| // If no args, show help | ||
| if cmd.Args().Len() == 0 { | ||
| return helpCommand(logger, version, "", "") |
Member
Author
There was a problem hiding this comment.
Show asdf's custom help output if no subcommand is specified.
Stratus3D
commented
Jul 9, 2026
| [[ "$output" == *"No .tool-versions version file found in parent directory"* ]] | ||
| } | ||
|
|
||
| @test "set with -h flag should show error for undefined flag" { |
Member
Author
There was a problem hiding this comment.
Without the above changes this test would fail.
Stratus3D
commented
Jul 9, 2026
| Version: version, | ||
| Copyright: "(c) 2024 Trevor Brown", | ||
| Authors: []any{ | ||
| mail.Address{Name: "Trevor Brown", Address: "someguy@example.com"}, |
244655c to
1d57949
Compare
…behavior * Disable `urfave/cli` help command and global help flag * Print asdf help when no subcommand is specified * Print asdf help with error message when unknown subcommand is specified * Remove incorrect email This fixes what was reported in #2228
1d57949 to
14eb087
Compare
-h flag that is causing confusing behavior-h flag that is causing confusing behavior
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
urfave/clihelp command and global help flagThis fixes what was reported in #2228